package com.iot.tob.platform.controller;


import com.iot.tob.platform.entity.BPlatformUser;
import com.iot.tob.platform.service.IBPlatformUserService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;


/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Alex Wu
 * @since 2025-03-24
 */

@RestController
@RequestMapping("/b-platform-user")
public class BPlatformUserController {

    @Autowired
    private IBPlatformUserService bPlatformUserService;

    @GetMapping("/{id}")
    public BPlatformUser getUserById(@PathVariable Long id) {
        return bPlatformUserService.getById(id);
    }

    @PostMapping
    public Boolean createUser(@RequestBody BPlatformUser user) {
        return bPlatformUserService.save(user);
    }

    @PutMapping("/{id}")
    public Boolean updateUser(@PathVariable Long id, @RequestBody BPlatformUser user) {
        return bPlatformUserService.updateById(user);
    }

    @DeleteMapping("/{id}")
    public void deleteUser(@PathVariable Long id) {
        bPlatformUserService.removeById(id);
    }
}